using Crocodile.AbstractLanguage;
using Crocodile.AbstractLanguage.Tree;
using JetBrains.Annotations;



namespace Crocodile.CsharpLanguage.Tree
{
    /// <summary>
    /// C# class or struct.
    /// </summary>
    public class CsClass : CsDeclaration
    {
        /// <summary>
        /// Das ding ist ein struct.
        /// </summary>
        public bool Struct;

        /// <summary>
        /// This class is a partial one.
        /// </summary>
        public bool Partial;

        /// <summary>
        /// Base class.
        /// </summary>
        [CanBeNull]
        public CsClass BaseClass;


        /// <summary>
        /// Declarations.
        /// </summary>
        [NotNull]
        public readonly Nest<CsClass,CsDeclaration> Declarations;


        public CsClass()
        {
            Declarations = new Nest<CsClass, CsDeclaration>(this);
        }


        public CsConstructor GetDefConstructor()
        {
            return Declarations.FirstOf<CsConstructor>(ctor => ctor.Parameters.IsEmpty);
        }
    }
}